package com.example.retrofit.controller;

import com.example.retrofit.api.UserApi;
import com.example.retrofit.domain.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author fans
 */
@Slf4j
@RequestMapping("/r/api/u")
@RestController
public class UserController {

    @Autowired
    private UserApi userApi;

    @GetMapping("/health")
    public String userHealth() {
        return userApi.healthCheck();
    }

    @PostMapping("/req")
    public String postRequest(@RequestHeader(value = "token") String token,@RequestBody User user) {
        return userApi.postReq(token, user);
    }
}
